import React,{PureComponent} from 'react';
import {connect} from 'react-redux';
import {Redirect} from 'react-router-dom';
import {WriteWrapper} from './style'

class Write extends PureComponent {
    render(){
        const {login}=this.props;
        if (login) {
            return (
                <WriteWrapper>写文章</WriteWrapper>
            )
        } else {
            return (
                <Redirect to='/login' />
            )
        }
    }
}

const mapStateToProps=(state)=>{
    return {
        login:state.get('login').get('login')
    }
}

export default connect(mapStateToProps,null)(Write)
